package com.peter.demo.annotations.configures.conditional;

import com.peter.project.entity.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfig {

    @Conditional(WinCondition.class)
    @Bean
    public Person xdd1(){
        System.out.println("将对象xdd1添加到IoC容器中");
        return new Person("xdd1",16);
    }

    @Conditional(WinCondition.class)
    @Bean
    public Person xdd2(){
        System.out.println("将对象xdd2添加到IoC容器中");
        return new Person("xdd2",17);
    }

    @Conditional(LinuxCondition.class)
    @Bean
    public Person xdd3(){
        System.out.println("将对象xdd3添加到IoC容器中");
        return new Person("xdd3",18);
    }
}
